package com.kaifamiao.month05.day09;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

public class Demo {

    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> bq = new ArrayBlockingQueue<>(2);
        bq.put("a");
        bq.put("b");
        System.out.println(bq);
//        bq.put("c");
        boolean flag = bq.offer("c", 3, TimeUnit.SECONDS);
        if (flag) {
            System.out.println(bq);
        } else {
            System.out.println("添加失败！");
        }
    }
}
